﻿using SchedulerManager.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SchedulerManager.Entity
{
    public class ScheduleEntity
    {
        /// <summary>
        /// 任务名称
        /// </summary>
        [Display(Name = "任务名称")]
        [Required(ErrorMessage = "请填写任务名称")]
        public string? JobName { get; set; }
        /// <summary>
        /// 任务分组
        /// </summary>
        [Display(Name = "任务分组")]
        [Required(ErrorMessage = "请填写任务分组")]
        public string? JobGroup { get; set; }

        [Display(Name = "选择分组")]
        public string? SelectJobGroup { get; set; }


        /// <summary>
        /// 程序集名称
        /// </summary>
        [Display(Name = "程序集名称")]
        [Required(ErrorMessage = "请填写程序集名称")]
        public string? DllName { get; set; }

        /// <summary>
        /// 任务实现类全名称
        /// </summary>
        [Display(Name = "任务实现类全名称")]
        [Required(ErrorMessage = "请填写任务实现类全名称")]
        public string? JobInstanceName { get; set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        [Display(Name = "开始时间")]
        public DateTimeOffset BeginTime { get; set; } = DateTime.Now;
        /// <summary>
        /// 结束时间
        /// </summary>
        [Display(Name = "结束时间")]
        public DateTimeOffset? EndTime { get; set; }
        /// <summary>
        /// Cron表达式
        /// </summary>
        [Display(Name = "Cron表达式")]
        public string? Cron { get; set; }
        /// <summary>
        /// 执行次数（默认无限循环）
        /// </summary>
        [Display(Name = "执行次数")]
        public int? RunTimes { get; set; }
        /// <summary>
        /// 执行间隔时间，单位秒（如果有Cron，则IntervalSecond失效）
        /// </summary>
        [Display(Name = "间隔时间")]
        public int? IntervalSecond { get; set; }
        /// <summary>
        /// 触发器类型
        /// </summary>
        [Display(Name = "触发器类型")]
        [Required(ErrorMessage = "请选择触发器类型")]
        public TriggerTypeEnum? TriggerType { get; set; }
        /// <summary>
        /// 描述
        /// </summary>
        [Display(Name = "任务描述")]
        [Required(ErrorMessage = "请填写任务描述")]
        public string? Description { get; set; }
    }
}
